$(function(){
    //详情数据
    getOrderList();
});
// 获取订单列表数据
function getOrderList () {
    $.ajax({
        type:"get",
        url: upUrl + "/orderInfo/front/orderInfoList",
        data: {},
        success:function(data){
            if (data.code == 0) {
                var testList = data.result.records;
                var orderBody = ''
                $.each(testList, function (index, val) {
                    orderBody += '<div class="order_list">\
                            <div>' + val.orderNo + '</div>\
                            <div>' + val.username + '</div>\
                            <div>' + val.totalPrice + '</div>\
                            <div>' + val.preferentialPrice + '</div>\
                            <div>' + val.orderPrice + '</div>\
                            <div>' + val.orderTime + '</div>\
                            <div>' + val.diningTable + '</div>\
                        </div>'
                })
                $('.item_box').html(orderBody);
            }
        }
    })
    // var orderBody = '';
    // var testList = [
    //     {
    //         rid: '1',
    //         orderPrice: '8元',
    //         receiver:'胡辣汤',
    //         orderNo:'333333333333333333333333',
    //         num: 12,
    //         orderTime: '2021-4-3 14:57:14',
    //         receiveAddress: '逍遥镇胡辣汤越喝越想念'
    //     },
    //     {
    //         rid: '2',
    //         orderPrice: '6元',
    //         orderNo: '44444444444444444444444444',
    //         receiver:'八宝粥',
    //         num: 2,
    //         orderTime: '2021-4-3 14:57:14',
    //         receiveAddress: '甜的八宝粥好喝又好看'
    //     },
    // ];
    // $.each(testList, function (index, val) {
    //     orderBody += '<div class="order_list">\
    //             <div>' + val.orderNo + '</div>\
    //             <div>' + val.receiver + '</div>\
    //             <div>' + val.orderPrice + '</div>\
    //             <div>' + val.orderTime + '</div>\
    //             <div>' + val.receiveAddress + '</div>\
    //         </div>'
    // })
    // $('.item_box').html(orderBody);
    // new Pagination({
    //     element: '#pages_2',
    //     type: 2,
    //     pageIndex: 1,
    //     pageSize: 8,
    //     pageCount: 9,
    //     total: 30,
    //     jumper: true,
    //     singlePageHide: false,
    //     disabled: true,
    //     currentChange: function(index) {
    //         console.log(index);
    //         pageNum = index;
    //         getDataList();
    //     }
    // });
}
function getDetailList () {
    $.ajax({
        type:"get",
        url: upUrl + "/journal/journalList",
        data: {
            pageNum:1,
            pageSize:10,
        },
        success:function(data){
            console.log(data)
            if (data.code == 0) {
                // detailList = data.result imgurl
                var orderBody = ''
                $.each(data.result.records, function (index, val) {
                    orderBody += '<div class="m_tourist">\
                        <div class="m_center">\
                            <div class="m_author">\
                                <div class="a_l mr10"><img src="http://yn1.tjtllxs.cn/head_img/ameko%E6%9E%9C%E6%9E%9C.jpeg" alt=""></div>\
                                <div class="a_r">\
                                    <span class="a_r_name">'+ val.uname +'</span><i class="iconfont icon-renzheng"></i> <span class="a_r_icon">旅游达人</span>\
                                    <div class="a_r_date mt5">'+ val.createTime +'</div>\
                                </div>\
                            </div>\
                            <div style="width: 700px;" class="mt10">'+ val.content +'</div>\
                            <div class="m_img mt20">\
                                <img src="' + val.imgurl + '" alt="">\
                                <div class="m_img_text">图片</div>\
                            </div>\
                        </div>\
                    </div>'
                })
                $('.box_main').html(orderBody);
            }
        }
    })
}